package com.rongmei.jdsync.dto.base;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * 基础响应DTO
 * 所有京东API响应DTO的基类
 *
 * @param <T> 响应数据的类型
 * @author dongjun
 */
@Data
@Schema(description = "基础响应DTO")
public class BaseResponseDto<T> {
    @Schema(description = "响应状态码")
    private long code;

    @Schema(description = "响应消息，成功时为'success'")
    private String message;

    @Schema(description = "响应数据")
    private T data;

    /**
     * 检查响应是否成功
     *
     * @return 如果响应成功返回true，否则返回false
     */
    public boolean isSuccess() {
        return code == 200;
    }
}
